def get_tracks_info(materials, data):
    # 提取所有 material_id 到一个列表中
    material_ids = [material['id'] for material in materials]

    # 创建 id 到 name 的映射
    material_id_to_name = {material['id']: material['material_name'] for material in materials}

    # 查找匹配的 render_index 和 track_render_index
    results = []
    for track in data['tracks']:
        for segment in track['segments']:
            material_id = segment['material_id']
            if material_id in material_ids:
                render_index = segment['render_index']
                track_render_index = segment['track_render_index']
                results.append({
                    'material_id': material_id,
                    'material_name': material_id_to_name[material_id],  # 通过映射获取 material_name
                    'render_index': render_index,
                    'track_render_index': track_render_index
                })
    return results
